package extractionStockageDonnees;

import java.util.Iterator;
import java.util.LinkedList;

/**
 * 
 * @author simon
 * 
 */
public class Step implements IStep {
	private LinkedList<PointCourse> myPoints;
	private String firstCity;
	private String lastCity;
	private double length;
	private EType type;
	private int turns;
	private Iterator pointer;

	/**
	 * Constructor
	 * 
	 * @param myPoints
	 * @param firstCity
	 * @param lastCity
	 * @param length
	 * @param type
	 * @param turns
	 */
	public Step(LinkedList<PointCourse> myPoints, String firstCity,
			String lastCity, EType type, int turns) {
		this.myPoints = myPoints;
		this.firstCity = firstCity;
		this.lastCity = lastCity;
		this.type = type;
		this.turns = turns;
		this.pointer = myPoints.iterator();
	}

	@Override
	public double getCurrentAltitude() {
		PointCourse p = (PointCourse) this.pointer;
		return p.getAltitude();
	}

	@Override
	public double getCurrentLatitude() {
		PointCourse p = (PointCourse) this.pointer;
		return p.getLatitude();
	}

	@Override
	public double getCurrentLongitude() {
		PointCourse p = (PointCourse) this.pointer;
		return p.getLongitude();
	}

	@Override
	public String getFirstCity() {
		return firstCity;
	}

	@Override
	public String getLastCity() {
		return lastCity;
	}

	/**
	 * TODO
	 */
	public double getLength() {
		return length;
	}

	@Override
	public String getName() {
		PointCourse p = (PointCourse) this.pointer;
		return p.getName();
	}

	@Override
	public int getTurns() {
		return turns;
	}

	@Override
	public EType getType() {
		return type;
	}

	@Override
	public boolean hasNext() {
		if (this.pointer.hasNext()) {
			return true;
		}
		return false;

	}

	@Override
	public void next() {
		this.pointer.next();

	}

	@Override
	public void reset() {
		this.pointer = myPoints.iterator();
		next();

	}

}
